package com.reindeer.common;

import lombok.Data;
import java.io.Serializable;

@Data
public class JsonResult<T> implements Serializable {
    
    private Integer code; // 状态码 1 成功 0 失败
    private String msg;   // 提示信息
    private T data;      // 数据

    public static <T> JsonResult<T> success(T data) {
        JsonResult<T> r = new JsonResult<>();
        r.code = 1;
        r.data = data;
        r.msg = "成功";
        return r;
    }

    public static <T> JsonResult<T> error(String msg) {
        JsonResult<T> r = new JsonResult<>();
        r.code = 0;
        r.msg = msg;
        return r;
    }
} 